package br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.util.locking;

import br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.util.Masker;
import br.edu.ufcg.lsd.wbis.ui.client.ui.management.PanelManager;

import com.google.gwt.user.client.ui.RootPanel;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;

/**
 * @author Renato Miceli
 * 
 */
public class LockButtonListener extends ButtonListenerAdapter {

	private final PanelManager panelManager;

	/**
	 * @param userInfoManager
	 */
	public LockButtonListener(PanelManager panelManager) {
		this.panelManager = panelManager;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void onClick(Button button, EventObject e) {
		Masker currentPanelMasker = new Masker(this.panelManager.getCurrentPanel());
		currentPanelMasker.mask();
		RootPanel.get().add(new UnlockingWindow(this.panelManager));
	}

}
